var maxscore = document.querySelector("#maxscore");
var point = document.querySelector(".pointSp ");
var res;
var grades = location.search.split("=")[1];
var result = []
console.log(grades)
point.innerText = grades;
//设置cookie储存分数；
function setCookie(grade, exdays) {
	var nowTime = new Date();
	nowTime.setTime(nowTime.getTime() + exdays * 24 * 3600 * 1000);
	var expires = nowTime.toGMTString();
	document.cookie = "grade=" + grade + ";" + "expires=" + expires;

}

//获取到cookie储存的分数
function getCookie() {
	var grade = document.cookie;
	res = grade.split("=");
	//				console.log(grade);
	//				console.log(res[1]);
	return maxscore.innerText = res[1];
	
}


function checkCookie() {
	var data = getCookie();
	console.log(data);
	//判断是否有cookie值传过阿拉
	if(data != "" && data != null && data != "null") {
//		 result.push(data);
		//将之前的cookie值与现在的cookie比较
		console.log("data不为空");
//		maxscore.innerText = data;
		console.log(grades,typeof(grades));
		if(parseInt(grades)>= parseInt(data)) {
			setCookie(grades, 2);
			getCookie();
		}
	} else {
		setCookie(grades, 2);
	}

}
checkCookie();